package com.xinghe.sharedevice.controller;

import com.share.common.core.web.controller.BaseController;
import com.share.common.core.web.domain.AjaxResult;
import com.xinghe.sharedevice.service.IRegionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 星河一叶Ck
 * @date 2025/5/27
 */

@Tag(name = "地区接口管理")
@RestController
@RequestMapping("/region")
@RequiredArgsConstructor
public class RegionController extends BaseController {

    private final IRegionService regionService;

    /**
     * 根据上级code获取下级地区列表数据
     * @param parentCode 父级地区代码
     * @return 子级地区数据
     */
    @Operation(summary = "根据上级code获取下级地区列表数据")
    @GetMapping("/treeSelect/{parentCode}")
    public AjaxResult treeSelect (@PathVariable String parentCode) {
        return success(regionService.treeSelect(parentCode));
    }
}
